home *** CD-ROM | disk | FTP | other *** search
/ Resource Library: Multimedia / Resource Library: Multimedia.iso / utils / sound / players / unix / xtank / xtank1.3f_ < prev    next >
Encoding:
Text File  |  1993-01-31  |  29.7 KB  |  1,045 lines

  1. #
  2. # xtank1.3f sound patches by Mark Boyns
  3. #
  4. # This sound patch to xtank1.3f will only work on Sun workstations
  5. # with sound support.  As far as I know this patch will only work
  6. # with an original xtank1.3f.
  7. #
  8. # Sound in xtank also requires that you have rplay version 2.0.
  9. # The older version of rplay will not work correctly.  If you
  10. # do not have rplay2.0 you can obtain it via anonymous ftp
  11. # at sounds.sdsu.edu.  Sound files can also be obtained at
  12. # sounds.sdsu.edu in the /pub/sounds/xtank directory.
  13. #
  14. # This patch does not really add any new sound features except
  15. # now specific sounds can be turned on/off in the Sounds/list
  16. # file.  The Imakefile in the Src directory expects to find
  17. # rplay.h in /usr/include, Src/Include, or /usr/local/include
  18. # and librplay.a in /usr/local/lib.  If these are in different
  19. # places you will have to edit the Imakefile in Src.
  20. #
  21. # To apply this patch
  22. # % cd your_xtank_directory (the one with Imakefile.Config)
  23. # % patch -p0 < sound-patches >& patchresults
  24. #
  25. # Send problems/question/comments to boyns@sciences.sdsu.edu.
  26. #
  27. # Have fun...
  28. #
  29. # Mark
  30. #
  31. *** /dev/null    Thu Nov 19 10:28:12 1992
  32. --- Sounds/list    Thu Nov 19 10:41:09 1992
  33. ***************
  34. *** 0 ****
  35. --- 1,48 ----
  36. + #
  37. + # This file contains the names of sound files used for sounds.
  38. + # The order of these sounds must correspond to the numbers in
  39. + # $(XTANK_DIR)/Src/Include/Sound.h.  Currenly only the first
  40. + # two strings on each line are read and anything else is ignored.
  41. + # The second string can be either "on" or "off" which will turn
  42. + # that sound on/off during the game.  Yes, I know it would be nice to 
  43. + # be able to turn on/off sounds inside xtank.
  44. + # 
  45. + click1.au        on    # lmg
  46. + click1.au        on    # mg 
  47. + click1.au        on    # hmg 
  48. + click1.au        on    # lrifle 
  49. + click1.au        on    # rifle 
  50. + click1.au        on    # hrifle 
  51. + click1.au        on    # lcannon 
  52. + click1.au        on    # cannon 
  53. + click1.au        on    # hcannon 
  54. + click1.au        on    # lrocket 
  55. + click1.au        on    # rocket 
  56. + click1.au        on    # hrocket 
  57. + click1.au        on    # acid 
  58. + click1.au        on    # flame 
  59. + drip.au        on    # mine 
  60. + Missle1.au        on    # seeker 
  61. + click1.au        on    # slick 
  62. + click1.au        on    # procket 
  63. + click1.au        on    # umissle 
  64. + click1.au        on    # harm 
  65. + click1.au        on    # disc 
  66. + bong.au        on    # vehicle hit wall
  67. + better_boing.au    on    # vehicle hit vehicle
  68. + arrp.au        on    # bullet hit vehicle
  69. + tap2.au        on    # bullet hit wall
  70. + boom.au        on    # tank explosion
  71. + arrp.au        on    # gleam explosion
  72. + arrp.au        on    # dam0 explosion
  73. + arrp.au        on    # dam1 explosion
  74. + arrp.au        on    # dam2 explosion
  75. + arrp.au        on    # dam3 explosion
  76. + arrp.au        on    # dam4 explosion
  77. + arrp.au        on    # exhaust explosion
  78. + arrp.au        on    # electric explosion
  79. + arrp.au        on    # damage explosion
  80. + sub_dive_horn.au    on    # start
  81. + game_over.au        on    # end
  82. + Sonar.au        on    # sonar
  83. + blip.au        on    # blip
  84. *** /dev/null    Thu Nov 19 10:28:12 1992
  85. --- Src/Include/sound.h    Fri Nov 13 11:22:36 1992
  86. ***************
  87. *** 0 ****
  88. --- 1,70 ----
  89. + #ifdef SOUND
  90. + #ifndef    _sound_h
  91. + #define    _sound_h
  92. + /*
  93. +  * This file contains the sound indexes into the sound table
  94. +  * The indexes here must be consistent with those in the file Sounds/list
  95. +  */
  96. + /*
  97. +  * maximum number of sounds
  98. +  */
  99. + #define MAX_SOUNDS            128
  100. + /*
  101. +  * sounds for all the types of weapons
  102. +  */
  103. + #define LMG_SOUND            0
  104. + #define MG_SOUND            1
  105. + #define HMG_SOUND            2
  106. + #define LRIFLE_SOUND            3
  107. + #define RIFLE_SOUND            4
  108. + #define HRIFLE_SOUND            5
  109. + #define LCANNON_SOUND            6
  110. + #define CANNON_SOUND            7
  111. + #define HCANNON_SOUND            8
  112. + #define LROCKET_SOUND            9
  113. + #define ROCKET_SOUND            10
  114. + #define HROCKET_SOUND            11
  115. + #define ACID_SOUND            12
  116. + #define FLAME_SOUND            13
  117. + #define MINE_SOUND            14
  118. + #define SEEKER_SOUND            15
  119. + #define SLICK_SOUND            16
  120. + #define PROCKET_SOUND            17
  121. + #define UMISSLE_SOUND            18
  122. + #define HARM_SOUND            19
  123. + #define DISC_SOUND            20
  124. + /*
  125. +  * things hitting things sounds
  126. +  */
  127. + #define VEHICLE_HIT_WALL_SOUND    21
  128. + #define VEHICLE_HIT_VEHICLE_SOUND    22
  129. + #define BULLET_HIT_VEHICLE_SOUND    23
  130. + #define BULLET_HIT_WALL_SOUND        24
  131. + /*
  132. +  * explosion sounds
  133. +  */
  134. + #define TANK_EXPLOSION_SOUND        25
  135. + #define GLEAM_EXPLOSION_SOUND        26
  136. + #define DAM0_EXPLOSION_SOUND        27
  137. + #define DAM1_EXPLOSION_SOUND        28
  138. + #define DAM2_EXPLOSION_SOUND        29
  139. + #define DAM3_EXPLOSION_SOUND        30
  140. + #define DAM4_EXPLOSION_SOUND        31
  141. + #define EXHAUST_EXPLOSION_SOUND    32
  142. + #define ELECTRIC_EXPLOSION_SOUND    33
  143. + #define DAMAGE_EXPLOSION_SOUND    34
  144. + /*
  145. +  * misc sounds
  146. +  */
  147. + #define START_SOUND            35
  148. + #define END_SOUND            36
  149. + #define SONAR_SOUND            37
  150. + #define BLIP_SOUND            38
  151. + #endif    _sound_h
  152. + #endif SOUND
  153. *** /dev/null    Thu Nov 19 10:28:12 1992
  154. --- Src/sound.c    Thu Nov 19 10:22:42 1992
  155. ***************
  156. *** 0 ****
  157. --- 1,209 ----
  158. + #ifdef SOUND
  159. + #include "limits.h"
  160. + #include "xtank.h"
  161. + #include "graphics.h"
  162. + #include "gr.h"
  163. + #include "xtanklib.h"
  164. + #include "vehicle.h"
  165. + #include "globals.h"
  166. + #include "terminal.h"
  167. + #include "assert.h"
  168. + #include <sys/types.h>
  169. + #include <sys/param.h>
  170. + #include <sys/socket.h>
  171. + #include <netinet/in.h>
  172. + #include <netdb.h>
  173. + #include <stdio.h>
  174. + #include "sound.h"
  175. + #include "rplay.h"
  176. + extern Terminal    *terminal[];
  177. + extern int    num_terminals;
  178. + extern Settings    settings;
  179. + extern char    pathname[], soundsdir[];
  180. + /*
  181. +  * the sound table
  182. +  */
  183. + RPLAY    *sound_table[MAX_SOUNDS];
  184. + /*
  185. +  * create RPLAY packets for all the sounds in Sounds/list
  186. +  */
  187. + init_sounds()
  188. + {
  189. +     char        buf[MAXPATHLEN];
  190. +     char        name[MAXPATHLEN];
  191. +     char        status[32];
  192. +     int        nsounds = 0;
  193. +     FILE        *fp;
  194. +     strcpy(name, pathname);
  195. +     strcat(name, "/");
  196. +     strcat(name, soundsdir);
  197. +     strcat(name, "/");
  198. +     strcat(name, "list");
  199. +     fp = fopen(name, "r");
  200. +     if (fp == NULL) {
  201. +         fprintf(stderr, "Could not open file %s.\n", name);
  202. +         exit(1);
  203. +     }
  204. +     while(fgets(buf, sizeof(buf), fp) != NULL) {
  205. +         switch(buf[0]) {
  206. +         case '#':
  207. +         case '\n':
  208. +         case '\0':
  209. +         case ' ':
  210. +         case '\t':
  211. +             continue;
  212. +         }
  213. +         sscanf(buf, "%s %s", name, status);
  214. +         if (strcmp(status, "on") == 0) {        /* ON */
  215. +             sound_table[nsounds] = rplay_create();
  216. +             if (sound_table[nsounds] == NULL) {
  217. +                 rplay_perror("rplay_create");
  218. +                 exit(1);
  219. +             }
  220. +             if (rplay_set(sound_table[nsounds], RPLAY_PLAY, name, NULL) < 0) {
  221. +                 rplay_perror("rplay_set");
  222. +                 exit(1);
  223. +             }
  224. +         }
  225. +         else if (strcmp(status, "off") == 0) {        /* OFF */
  226. +             sound_table[nsounds] = NULL;
  227. +         }
  228. +         else {
  229. +             fprintf(stderr, "Unknown sound status '%s'.\n", status);
  230. +         }
  231. +         nsounds++;
  232. +     } 
  233. + }
  234. + /*
  235. +  * initialize sound for the given terminal
  236. +  */
  237. + init_terminal_sound(t)
  238. + Terminal    *t;
  239. + {
  240. +     char        *p, *rindex();
  241. +     Video        *vidptr;
  242. +     char        hostname[MAXHOSTNAMELEN];
  243. +     int        i;
  244. +     draw_text_rc(ANIM_WIN, 0, 1, "Initializing Sounds...", M_FONT, WHITE);
  245. +     sync_output(TRUE);
  246. +     /*
  247. +      * get the display hostname 
  248. +      */
  249. +     vidptr = (Video *)t->video;
  250. +     strcat(hostname, vidptr->display_name);
  251. +     p = rindex(hostname, ':');
  252. +     *p = '\0';
  253. +     if (*hostname == '\0') {
  254. +         gethostname(hostname, sizeof(hostname));
  255. +     }
  256. +     /*
  257. +      * initialize rplayd connection
  258. +      */
  259. +     t->rplay_fd = rplay_open(hostname);
  260. +     if (t->rplay_fd < 0) {
  261. +         rplay_perror(hostname);
  262. +         return;
  263. +     }
  264. +     play_terminal(t, SONAR_SOUND);
  265. + }
  266. + /*
  267. +  * play a sound on a terminal
  268. +  */
  269. + play_terminal(t, index)
  270. + Terminal    *t;
  271. + int        index;
  272. + {
  273. +     if (!settings.si.no_sound) {
  274. +         if (t->rplay_fd > 0 && sound_table[index] > 0)
  275. +             rplay(t->rplay_fd, sound_table[index]);
  276. +     }
  277. + }
  278. + /*
  279. +  * play a sound on all terminals
  280. +  */
  281. + play_all(index)
  282. + int    index;
  283. + {
  284. +     if (!settings.si.no_sound) {
  285. +         int    x;
  286. +     
  287. +         for(x = 0; x < num_terminals; x++)
  288. +             if (terminal[x]->rplay_fd > 0 && sound_table[index] != NULL)
  289. +                 rplay(terminal[x]->rplay_fd, sound_table[index]);
  290. +     }
  291. + }
  292. + /*
  293. +  * play a sound on the terminal "owning" or watching this tank
  294. +  */
  295. + play_owner(vehicle, index)
  296. + Vehicle        *vehicle;
  297. + int        index;
  298. + {
  299. +     if (!settings.si.no_sound) {
  300. +         int    x, y;
  301. +         for (x = 0; x < vehicle->owner->num_players; x++) {
  302. +             y = vehicle->owner->player[x];
  303. +             if (terminal[y]->rplay_fd > 0 && sound_table[index] != NULL)
  304. +                 rplay(terminal[y]->rplay_fd, sound_table[index]);
  305. +         }
  306. +     }
  307. + }
  308. + /*
  309. +  * play a sound on the terminal that has this location in view
  310. +  */
  311. + play_in_view(loc, index)
  312. + Loc    *loc;
  313. + int    index;
  314. + {
  315. +     if (!settings.si.no_sound) {
  316. +         int    x, dx, dy;
  317. +         int    t_x = loc->x;
  318. +         int    t_y = loc->y;
  319. +         for (x = 0; x < num_terminals; x++) {
  320. +             dx = t_x - terminal[x]->loc.x;
  321. +             dy = t_y - terminal[x]->loc.y;
  322. +             if (dx >= 0 && dx <= ANIM_WIN_WIDTH && dy >= 0 && dy <= ANIM_WIN_HEIGHT &&
  323. +                 terminal[x]->rplay_fd > 0 && sound_table[index] != NULL)
  324. +                 rplay(terminal[x]->rplay_fd, sound_table[index]);
  325. +         }
  326. +     }
  327. + }
  328. + /*
  329. +  * play a sound on the terminal that has this location in view
  330. +  */
  331. + play_in_view_x_y(t_x, t_y, index)
  332. + int    t_x;
  333. + int    t_y;
  334. + int    index;
  335. + {
  336. +     if (!settings.si.no_sound) {
  337. +         int    x, dx, dy;
  338. +         for (x = 0; x < num_terminals; x++) {
  339. +             dx = t_x - terminal[x]->loc.x;
  340. +             dy = t_y - terminal[x]->loc.y;
  341. +             if (dx >= 0 && dx <= ANIM_WIN_WIDTH && dy >= 0 && dy <= ANIM_WIN_HEIGHT &&
  342. +                 terminal[x]->rplay_fd > 0 && sound_table[index] != NULL)
  343. +                 rplay(terminal[x]->rplay_fd, sound_table[index]);
  344. +         }
  345. +     }
  346. + }
  347. + #endif SOUND
  348. Common subdirectories: ./Bin and ../xtank1.3f-sound/Bin
  349. Common subdirectories: ./Doc and ../xtank1.3f-sound/Doc
  350. Common subdirectories: ./Help and ../xtank1.3f-sound/Help
  351. diff -c -r ./Imakefile.Config ../xtank1.3f-sound/Imakefile.Config
  352. *** ./Imakefile.Config    Sat Sep 12 12:37:30 1992
  353. --- ../xtank1.3f-sound/Imakefile.Config    Fri Nov 13 12:50:24 1992
  354. ***************
  355. *** 173,179 ****
  356.   DEFINES2        = -DX11 -DUNIX -DS1024x864 -DKEYPAD_DETECT \
  357.           -DSTINGY_REDRAW -DBATCH_LINES -DBATCH_POINTS \
  358.           -DBATCH_COLOR_LINES \
  359. !         -DCODE_SIZE=0x20000 -DSTACK_SIZE=0x8000 $(ARCH_DEFINES)
  360.   
  361.   DEFINES         = -DXTANK_DIR=\"/src/pub/xtank\" $(DEFINES2) \
  362.           -DALLDEFINES="\"$(DEFINES2)\""
  363. --- 173,180 ----
  364.   DEFINES2        = -DX11 -DUNIX -DS1024x864 -DKEYPAD_DETECT \
  365.           -DSTINGY_REDRAW -DBATCH_LINES -DBATCH_POINTS \
  366.           -DBATCH_COLOR_LINES \
  367. !         -DCODE_SIZE=0x20000 -DSTACK_SIZE=0x8000 $(ARCH_DEFINES) \
  368. !         -DSOUND
  369.   
  370.   DEFINES         = -DXTANK_DIR=\"/src/pub/xtank\" $(DEFINES2) \
  371.           -DALLDEFINES="\"$(DEFINES2)\""
  372. Common subdirectories: ./Mazes and ../xtank1.3f-sound/Mazes
  373. Common subdirectories: ./Programs and ../xtank1.3f-sound/Programs
  374. Common subdirectories: ./Src and ../xtank1.3f-sound/Src
  375. Common subdirectories: ./Todo and ../xtank1.3f-sound/Todo
  376. Common subdirectories: ./Util and ../xtank1.3f-sound/Util
  377. Common subdirectories: ./Vehicles and ../xtank1.3f-sound/Vehicles
  378. diff -c -r ./Bin/xtank ../xtank1.3f-sound/Bin/xtank
  379. *** ./Bin/xtank    Sat Feb  1 14:00:59 1992
  380. --- ../xtank1.3f-sound/Bin/xtank    Thu Nov 19 10:25:43 1992
  381. ***************
  382. *** 3,8 ****
  383. --- 3,9 ----
  384.   XTANK_VEHICLES=Vehicles
  385.   XTANK_MAZES=Mazes
  386.   XTANK_PROGRAMS=Programs
  387. + XTANK_SOUNDS=Sounds
  388.   
  389.   #
  390.   # rpotter thinks this is a kludge, I think it is funny! (lidl)
  391. Common subdirectories: ./Doc/Src and ../xtank1.3f-sound/Doc/Src
  392. Common subdirectories: ./Programs/Old and ../xtank1.3f-sound/Programs/Old
  393. Common subdirectories: ./Programs/Old/Old and ../xtank1.3f-sound/Programs/Old/Old
  394. Common subdirectories: ./Src/Fixed-Point and ../xtank1.3f-sound/Src/Fixed-Point
  395. diff -c -r ./Src/Imakefile ../xtank1.3f-sound/Src/Imakefile
  396. *** ./Src/Imakefile    Sat Sep 12 12:36:46 1992
  397. --- ../xtank1.3f-sound/Src/Imakefile    Fri Nov 13 13:14:23 1992
  398. ***************
  399. *** 17,23 ****
  400.                       program.c radar.c repair.c scroll.c setup.c setups.c \
  401.                       status.c sysdep.c thread.c unix.c update.c util.c \
  402.                       vdesign.c vehicle.c players.c newfile.c vload.c \
  403. !                     version.c $(SRCS2)
  404.                OBJS = 3d.o XMultiSync.o actions.o animate.o box.o camo.o \
  405.                       collision.o cosell.o disc.o display.o escher.o \
  406.                       explosion.o file.o game.o gr.o graphics.o highlib.o \
  407. --- 17,23 ----
  408.                       program.c radar.c repair.c scroll.c setup.c setups.c \
  409.                       status.c sysdep.c thread.c unix.c update.c util.c \
  410.                       vdesign.c vehicle.c players.c newfile.c vload.c \
  411. !                     version.c sound.c $(SRCS2)
  412.                OBJS = 3d.o XMultiSync.o actions.o animate.o box.o camo.o \
  413.                       collision.o cosell.o disc.o display.o escher.o \
  414.                       explosion.o file.o game.o gr.o graphics.o highlib.o \
  415. ***************
  416. *** 27,33 ****
  417.                       program.o radar.o repair.o scroll.o setup.o setups.o \
  418.                       status.o sysdep.o thread.o unix.o update.o util.o \
  419.                       vdesign.o vehicle.o players.o newfile.o vload.o \
  420. !                     version.o $(OBJS2)
  421.                INCL = Include/bullet.h Include/common.h Include/cosell.h \
  422.                       Include/disc.h Include/game.h Include/globals.h \
  423.                       Include/gr.h Include/graphics.h Include/icounter.h \
  424. --- 27,33 ----
  425.                       program.o radar.o repair.o scroll.o setup.o setups.o \
  426.                       status.o sysdep.o thread.o unix.o update.o util.o \
  427.                       vdesign.o vehicle.o players.o newfile.o vload.o \
  428. !                     version.o sound.o $(OBJS2)
  429.                INCL = Include/bullet.h Include/common.h Include/cosell.h \
  430.                       Include/disc.h Include/game.h Include/globals.h \
  431.                       Include/gr.h Include/graphics.h Include/icounter.h \
  432. ***************
  433. *** 41,47 ****
  434.                       Include/team.h Include/terminal.h Include/thread.h \
  435.                       Include/tread-defs.h Include/vdesc.h Include/vehicle.h \
  436.                       Include/vehicleparts.h Include/vstructs.h \
  437. !                     Include/weapon-defs.h Include/xtank.h Include/xtanklib.h
  438.               XINCL = Include/x11.h
  439.   
  440.   /**/# Note that both x11.c and mazeconv.c are included in other .c files,
  441. --- 41,48 ----
  442.                       Include/team.h Include/terminal.h Include/thread.h \
  443.                       Include/tread-defs.h Include/vdesc.h Include/vehicle.h \
  444.                       Include/vehicleparts.h Include/vstructs.h \
  445. !                     Include/weapon-defs.h Include/xtank.h Include/xtanklib.h \
  446. !             Include/sound.h
  447.               XINCL = Include/x11.h
  448.   
  449.   /**/# Note that both x11.c and mazeconv.c are included in other .c files,
  450. ***************
  451. *** 49,59 ****
  452.   
  453.   /**/# Important things that Xtank wants to find
  454.   
  455. !    EXTRA_INCLUDES = -I. -IInclude
  456.   
  457.   /**/# Everybody needs the following libraries
  458.   
  459. !   EXTRA_LIBRARIES = -LPrograms -lxtankrobots -lm
  460.   
  461.   /**/# Start of System Dependent Things
  462.   /**/# (e.g. libraries, linker flags and so forth)
  463. --- 50,60 ----
  464.   
  465.   /**/# Important things that Xtank wants to find
  466.   
  467. !    EXTRA_INCLUDES = -I. -IInclude -I/usr/local/include
  468.   
  469.   /**/# Everybody needs the following libraries
  470.   
  471. !   EXTRA_LIBRARIES = -LPrograms -lxtankrobots -lm -L/usr/local/lib -lrplay
  472.   
  473.   /**/# Start of System Dependent Things
  474.   /**/# (e.g. libraries, linker flags and so forth)
  475. Common subdirectories: ./Src/Include and ../xtank1.3f-sound/Src/Include
  476. Common subdirectories: ./Src/Objects and ../xtank1.3f-sound/Src/Objects
  477. Common subdirectories: ./Src/Old and ../xtank1.3f-sound/Src/Old
  478. Common subdirectories: ./Src/Programs and ../xtank1.3f-sound/Src/Programs
  479. diff -c -r ./Src/explosion.c ../xtank1.3f-sound/Src/explosion.c
  480. *** ./Src/explosion.c    Sat Sep 12 12:51:48 1992
  481. --- ../xtank1.3f-sound/Src/explosion.c    Fri Nov 13 11:28:33 1992
  482. ***************
  483. *** 13,18 ****
  484. --- 13,21 ----
  485.   #include "bullet.h"
  486.   #include "graphics.h"
  487.   #include "loc.h"
  488. + #ifdef SOUND
  489. + #include "sound.h"
  490. + #endif SOUND
  491.   
  492.   
  493.   #define EXP_SPREAD 15
  494. ***************
  495. *** 32,37 ****
  496. --- 35,75 ----
  497.   
  498.       if (eset->number >= MAX_EXPS)
  499.       return;
  500. + #ifdef SOUND
  501. +      switch (type) {
  502. +         case EXP_TANK:
  503. +                 play_in_view(loc, TANK_EXPLOSION_SOUND);
  504. +                 break;
  505. +         case EXP_GLEAM:
  506. +                 play_in_view(loc, GLEAM_EXPLOSION_SOUND);
  507. +                 break;
  508. +         case EXP_DAM0:
  509. +                 play_in_view(loc, DAM0_EXPLOSION_SOUND);
  510. +                 break;
  511. +         case EXP_DAM1:
  512. +                 play_in_view(loc, DAM1_EXPLOSION_SOUND);
  513. +                 break;
  514. +         case EXP_DAM2:
  515. +                 play_in_view(loc, DAM2_EXPLOSION_SOUND);
  516. +                 break;
  517. +         case EXP_DAM3:
  518. +                 play_in_view(loc, DAM3_EXPLOSION_SOUND);
  519. +                 break;
  520. +         case EXP_DAM4:
  521. +                 play_in_view(loc, DAM4_EXPLOSION_SOUND);
  522. +                 break;
  523. +         case EXP_EXHAUST:
  524. +                 play_in_view(loc, EXHAUST_EXPLOSION_SOUND);
  525. +                 break;
  526. +         case EXP_ELECTRIC:
  527. +                 play_in_view(loc, ELECTRIC_EXPLOSION_SOUND);
  528. +                 break;
  529. +         default:
  530. +                 play_in_view(loc, DAMAGE_EXPLOSION_SOUND);
  531. +     }
  532. + #endif SOUND
  533.       e = eset->list[eset->number++];
  534.       e->x = (int) loc->x;
  535.       e->y = (int) loc->y;
  536. diff -c -r ./Src/file.c ../xtank1.3f-sound/Src/file.c
  537. *** ./Src/file.c    Sun Sep 13 18:06:56 1992
  538. --- ../xtank1.3f-sound/Src/file.c    Fri Nov 13 13:47:59 1992
  539. ***************
  540. *** 139,144 ****
  541. --- 139,147 ----
  542.   char pathname[MAXPATHLEN];
  543.   char headersdir[MAXPATHLEN];    /* full name of directory to find headers in */
  544.   char vehiclesdir[MAXNAMLEN], mazesdir[MAXNAMLEN], programsdir[MAXNAMLEN];
  545. + #ifdef SOUND
  546. + char soundsdir[MAXNAMLEN];
  547. + #endif SOUND
  548.   char username[MAX_STRING], displayname[256];
  549.   
  550.   #ifdef NEED_AUX_FONT
  551. ***************
  552. *** 187,193 ****
  553.       (void) strcpy(filename, "XVDIR:list");
  554.   #endif /* AMIGA */
  555.   
  556. !     draw_text_rc(ANIM_WIN, 0, 1, "Reading vehicle list...", M_FONT, WHITE);
  557.       sync_output(TRUE);
  558.       if ((file = fopen(filename, "r")) != NULL)
  559.       {
  560. --- 190,196 ----
  561.       (void) strcpy(filename, "XVDIR:list");
  562.   #endif /* AMIGA */
  563.   
  564. !     draw_text_rc(ANIM_WIN, 0, 2, "Reading vehicle list...", M_FONT, WHITE);
  565.       sync_output(TRUE);
  566.       if ((file = fopen(filename, "r")) != NULL)
  567.       {
  568. ***************
  569. *** 215,221 ****
  570.       (void) strcpy(filename, "XMDIR:list");
  571.   #endif /* AMIGA */
  572.   
  573. !     draw_text_rc(ANIM_WIN, 0, 2, "Reading maze list...", M_FONT, WHITE);
  574.       sync_output(TRUE);
  575.       if ((file = fopen(filename, "r")) != NULL)
  576.       {
  577. --- 218,224 ----
  578.       (void) strcpy(filename, "XMDIR:list");
  579.   #endif /* AMIGA */
  580.   
  581. !     draw_text_rc(ANIM_WIN, 0, 3, "Reading maze list...", M_FONT, WHITE);
  582.       sync_output(TRUE);
  583.       if ((file = fopen(filename, "r")) != NULL)
  584.       {
  585. ***************
  586. *** 748,753 ****
  587. --- 751,759 ----
  588.       strcpy(vehiclesdir, (p = getenv("XTANK_VEHICLES")) ? p : "Vehicles");
  589.       strcpy(mazesdir, (p = getenv("XTANK_MAZES")) ? p : "Mazes");
  590.       strcpy(programsdir, (p = getenv("XTANK_PROGRAMS")) ? p : "Programs");
  591. + #ifdef SOUND
  592. +     strcpy(soundsdir, (p = getenv("XTANK_SOUNDS")) ? p : "Sounds");
  593. + #endif SOUND
  594.       if ((p = getenv("XTANK_HEADERS")) != NULL) {
  595.           strcpy(headersdir, p);
  596.       } else {
  597. diff -c -r ./Src/gr.c ../xtank1.3f-sound/Src/gr.c
  598. *** ./Src/gr.c    Sun Aug 30 14:15:11 1992
  599. --- ../xtank1.3f-sound/Src/gr.c    Fri Nov 13 13:02:25 1992
  600. ***************
  601. *** 134,139 ****
  602. --- 134,143 ----
  603.       /* Initialize 3D values for terminal */
  604.       init_terminal_3d(t);
  605.   
  606. + #ifdef SOUND
  607. +     init_terminal_sound(t);
  608. + #endif SOUND
  609.       return 0;
  610.   }
  611.   
  612. ***************
  613. *** 174,179 ****
  614. --- 178,188 ----
  615.   close_terminal(t)
  616.   Terminal *t;
  617.   {
  618. + #ifdef SOUND
  619. +     if (t->rplay_fd > 0) {
  620. +         rplay_close(t->rplay_fd);
  621. +     }
  622. + #endif SOUND
  623.       close_video((Video *) t->video);
  624.       free((char *) t);
  625.   }
  626. diff -c -r ./Src/hit.c ../xtank1.3f-sound/Src/hit.c
  627. *** ./Src/hit.c    Sun Sep 13 00:04:34 1992
  628. --- ../xtank1.3f-sound/Src/hit.c    Fri Nov 13 13:03:58 1992
  629. ***************
  630. *** 66,73 ****
  631.   #include "terminal.h"
  632.   #include "cosell.h"
  633.   #include "globals.h"
  634.   
  635.   extern Map real_map;
  636.   extern Settings settings;
  637.   
  638. --- 66,75 ----
  639.   #include "terminal.h"
  640.   #include "cosell.h"
  641.   #include "globals.h"
  642. + #ifdef SOUND
  643. + #include "sound.h"
  644. + #endif SOUND
  645.   
  646.   extern Map real_map;
  647.   extern Settings settings;
  648.   
  649. ***************
  650. *** 116,121 ****
  651. --- 118,127 ----
  652.       Side side;
  653.       int has_ramplate1, has_ramplate2;
  654.   
  655. + #ifdef SOUND
  656. +     play_in_view(v1->loc, VEHICLE_HIT_VEHICLE_SOUND);
  657. + #endif SOUND
  658.   #ifdef GDEBUG
  659.       int itemp1, itemp2;
  660.       static FILE *statfile = NULL;
  661. ***************
  662. *** 257,262 ****
  663. --- 263,272 ----
  664.       int dx, dy, damage, damage1, damage2;
  665.       int has_ramplate = FALSE;
  666.   
  667. + #ifdef SOUND
  668. +     play_in_view(v->loc, VEHICLE_HIT_WALL_SOUND);
  669. + #endif SOUND
  670.   #ifdef GDEBUG
  671.       int itemp1, itemp2;
  672.       static FILE *statfile = NULL;
  673. ***************
  674. *** 684,689 ****
  675. --- 694,702 ----
  676.       b->flags &= ~wl;
  677.       /* tell all the combatants to update their map */
  678.       invalidate_maps();
  679. + #ifdef SOUND
  680. +     play_in_view_x_y(x, y, TANK_EXPLOSION_SOUND);
  681. + #endif SOUND
  682.       }
  683.   
  684.       return damage;
  685. diff -c -r ./Src/init.c ../xtank1.3f-sound/Src/init.c
  686. *** ./Src/init.c    Sun Aug 30 14:15:12 1992
  687. --- ../xtank1.3f-sound/Src/init.c    Fri Nov 13 11:40:42 1992
  688. ***************
  689. *** 100,105 ****
  690. --- 100,108 ----
  691.           FALSE,        /* Boolean no_nametags */
  692.           TRUE,        /* Boolean team_score GHS */
  693.           FALSE,        /* Boolean no_radar */
  694. + #ifdef SOUND
  695. +         FALSE,        /* Boolean no_sound */
  696. + #endif SOUND
  697.           TRUE,        /* Boolean player_teleport */
  698.           TRUE,        /* Boolean disc_teleport */
  699.           TRUE,        /* Boolean teleport_from_team */
  700. diff -c -r ./Src/interface.c ../xtank1.3f-sound/Src/interface.c
  701. *** ./Src/interface.c    Sat Sep 12 12:51:47 1992
  702. --- ../xtank1.3f-sound/Src/interface.c    Fri Nov 13 11:45:14 1992
  703. ***************
  704. *** 254,259 ****
  705. --- 254,262 ----
  706.               "Ultimate:Own Goal", "Robots don't Win",
  707.               "Scale Armor to Max", "No name tags",
  708.               "Team Scoring", "Disable RADAR",
  709. + #ifdef SOUND
  710. +             "Disable Sound",
  711. + #endif SOUND
  712.               "Players can Teleport", "Discs can Teleport",
  713.               "'port from team", "'port from neutral",
  714.               "'port to team", "'port to neutral",
  715. ***************
  716. *** 357,376 ****
  717.           menu_set_hil(&menu_sys, FLAGS_MENU, 14);
  718.       if (settings.si.no_radar)
  719.           menu_set_hil(&menu_sys, FLAGS_MENU, 15);
  720.       if (settings.si.player_teleport)
  721. -     menu_set_hil(&menu_sys, FLAGS_MENU, 16);
  722. -     if (settings.si.disc_teleport)
  723.       menu_set_hil(&menu_sys, FLAGS_MENU, 17);
  724. !     if (settings.si.teleport_from_team)
  725.       menu_set_hil(&menu_sys, FLAGS_MENU, 18);
  726. !     if (settings.si.teleport_from_neutral)
  727.       menu_set_hil(&menu_sys, FLAGS_MENU, 19);
  728. !     if (settings.si.teleport_to_team)
  729.       menu_set_hil(&menu_sys, FLAGS_MENU, 20);
  730. !     if (settings.si.teleport_to_neutral)
  731.       menu_set_hil(&menu_sys, FLAGS_MENU, 21);
  732. !     if (settings.si.teleport_any_to_any)
  733.       menu_set_hil(&menu_sys, FLAGS_MENU, 22);
  734.   
  735.   }
  736.   
  737. --- 360,383 ----
  738.           menu_set_hil(&menu_sys, FLAGS_MENU, 14);
  739.       if (settings.si.no_radar)
  740.           menu_set_hil(&menu_sys, FLAGS_MENU, 15);
  741. + #ifdef SOUND
  742. +     if (settings.si.no_sound)
  743. +         menu_set_hil(&menu_sys, FLAGS_MENU, 16);
  744. + #endif SOUND
  745.       if (settings.si.player_teleport)
  746.       menu_set_hil(&menu_sys, FLAGS_MENU, 17);
  747. !     if (settings.si.disc_teleport)
  748.       menu_set_hil(&menu_sys, FLAGS_MENU, 18);
  749. !     if (settings.si.teleport_from_team)
  750.       menu_set_hil(&menu_sys, FLAGS_MENU, 19);
  751. !     if (settings.si.teleport_from_neutral)
  752.       menu_set_hil(&menu_sys, FLAGS_MENU, 20);
  753. !     if (settings.si.teleport_to_team)
  754.       menu_set_hil(&menu_sys, FLAGS_MENU, 21);
  755. !     if (settings.si.teleport_to_neutral)
  756.       menu_set_hil(&menu_sys, FLAGS_MENU, 22);
  757. +     if (settings.si.teleport_any_to_any)
  758. +     menu_set_hil(&menu_sys, FLAGS_MENU, 23);
  759.   
  760.   }
  761.   
  762. ***************
  763. *** 937,960 ****
  764.               settings.si.no_radar ^= TRUE;
  765.               break;
  766.           case 16:
  767. !             settings.si.player_teleport ^= TRUE;
  768.               break;
  769.           case 17:
  770. !             settings.si.disc_teleport ^= TRUE;
  771.               break;
  772.           case 18:
  773. !             settings.si.teleport_from_team ^= TRUE;
  774.               break;
  775.           case 19:
  776. !             settings.si.teleport_from_neutral ^= TRUE;
  777.               break;
  778.           case 20:
  779. !             settings.si.teleport_to_team ^= TRUE;
  780.               break;
  781.           case 21:
  782. !             settings.si.teleport_to_neutral ^= TRUE;
  783.               break;
  784.           case 22:
  785.               settings.si.teleport_any_to_any ^= TRUE;
  786.               break;
  787.       }
  788. --- 944,970 ----
  789.               settings.si.no_radar ^= TRUE;
  790.               break;
  791.           case 16:
  792. !             settings.si.no_sound ^= TRUE;
  793.               break;
  794.           case 17:
  795. !             settings.si.player_teleport ^= TRUE;
  796.               break;
  797.           case 18:
  798. !             settings.si.disc_teleport ^= TRUE;
  799.               break;
  800.           case 19:
  801. !             settings.si.teleport_from_team ^= TRUE;
  802.               break;
  803.           case 20:
  804. !             settings.si.teleport_from_neutral ^= TRUE;
  805.               break;
  806.           case 21:
  807. !             settings.si.teleport_to_team ^= TRUE;
  808.               break;
  809.           case 22:
  810. +             settings.si.teleport_to_neutral ^= TRUE;
  811. +             break;
  812. +         case 23:
  813.               settings.si.teleport_any_to_any ^= TRUE;
  814.               break;
  815.       }
  816. diff -c -r ./Src/lowlib.c ../xtank1.3f-sound/Src/lowlib.c
  817. *** ./Src/lowlib.c    Sun Sep 13 00:04:36 1992
  818. --- ../xtank1.3f-sound/Src/lowlib.c    Fri Nov 13 11:49:44 1992
  819. ***************
  820. *** 83,88 ****
  821. --- 83,91 ----
  822.   #include "outpost.h"
  823.   #include "globals.h"
  824.   #include "graphics.h"
  825. + #ifdef SOUND
  826. + #include "sound.h"
  827. + #endif SOUND
  828.   
  829.   extern Weapon_stat weapon_stat[];
  830.   extern Armor_stat armor_stat[];
  831. ***************
  832. *** 694,699 ****
  833. --- 697,769 ----
  834.   
  835.       cv->frame_weapon_fired = frame;
  836.   
  837. + #ifdef SOUND
  838. +         switch(w->type) {
  839. +         case LMG:
  840. +                 play_in_view(cv->loc, LMG_SOUND);
  841. +                 break;
  842. +         case MG:
  843. +                 play_in_view(cv->loc, MG_SOUND);
  844. +                 break;
  845. +         case HMG:
  846. +                 play_in_view(cv->loc, HMG_SOUND);
  847. +                 break;
  848. +         case LRIFLE:
  849. +                 play_in_view(cv->loc, LRIFLE_SOUND);
  850. +                 break;
  851. +         case RIFLE:
  852. +                 play_in_view(cv->loc, RIFLE_SOUND);
  853. +                 break;
  854. +         case HRIFLE:
  855. +                 play_in_view(cv->loc, HRIFLE_SOUND);
  856. +                 break;
  857. +         case LCANNON:
  858. +                 play_in_view(cv->loc, LCANNON_SOUND);
  859. +                 break;
  860. +         case CANNON:
  861. +                 play_in_view(cv->loc, CANNON_SOUND);
  862. +                 break;
  863. +         case HCANNON:
  864. +                 play_in_view(cv->loc, HCANNON_SOUND);
  865. +                 break;
  866. +         case LROCKET:
  867. +                 play_in_view(cv->loc, LROCKET_SOUND);
  868. +                 break;
  869. +         case ROCKET:
  870. +                 play_in_view(cv->loc, ROCKET_SOUND);
  871. +                 break;
  872. +         case HROCKET:
  873. +                 play_in_view(cv->loc, HROCKET_SOUND);
  874. +                 break;
  875. +         case ACID:
  876. +                 play_in_view(cv->loc, ACID_SOUND);
  877. +                 break;
  878. +         case FLAME:
  879. +                 play_in_view(cv->loc, FLAME_SOUND);
  880. +                 break;
  881. +         case MINE:
  882. +                 play_in_view(cv->loc, MINE_SOUND);
  883. +                 break;
  884. +         case SEEKER:
  885. +                 play_in_view(cv->loc, SEEKER_SOUND);
  886. +                 break;
  887. +         case SLICK:
  888. +                 play_in_view(cv->loc, SLICK_SOUND);
  889. +                 break;
  890. +         case PROCKET:
  891. +                 play_in_view(cv->loc, PROCKET_SOUND);
  892. +                 break;
  893. +         case UMISSLE:
  894. +                 play_in_view(cv->loc, UMISSLE_SOUND);
  895. +                 break;
  896. +         case HARM:
  897. +                 play_in_view(cv->loc, HARM_SOUND);
  898. +                 break;
  899. +         case DISC:
  900. +                 play_in_view(cv->loc, DISC_SOUND);
  901. +                 break;
  902. +         }
  903. + #endif SOUND
  904.       }
  905.   
  906.       check_time();
  907. diff -c -r ./Src/main.c ../xtank1.3f-sound/Src/main.c
  908. *** ./Src/main.c    Sat Sep 12 12:51:46 1992
  909. --- ../xtank1.3f-sound/Src/main.c    Fri Nov 13 13:49:19 1992
  910. ***************
  911. *** 286,291 ****
  912. --- 286,294 ----
  913.       init_settings();
  914.       init_threader();
  915.       init_msg_sys();
  916. + #ifdef SOUND
  917. +     init_sounds();
  918. + #endif SOUND
  919.   
  920.       /* Rotate vehicle objects */
  921.       debug("Rotating vehicle objects");
  922. diff -c -r ./Src/radar.c ../xtank1.3f-sound/Src/radar.c
  923. *** ./Src/radar.c    Sun Sep 13 00:04:42 1992
  924. --- ../xtank1.3f-sound/Src/radar.c    Fri Nov 13 11:52:12 1992
  925. ***************
  926. *** 52,57 ****
  927. --- 52,60 ----
  928.   #include "vehicle.h"
  929.   #include "globals.h"
  930.   #include "bullet.h"
  931. + #ifdef SOUND
  932. + #include "sound.h"
  933. + #endif SOUND
  934.   
  935.   extern Map real_map;
  936.   
  937. ***************
  938. *** 212,217 ****
  939. --- 215,223 ----
  940.   
  941.               if (vehicle_flags) {
  942.   #endif /* !NO_CAMO */
  943. + #ifdef SOUND
  944. +         play_owner(v, BLIP_SOUND);
  945. + #endif SOUND
  946.           b = &r->blip[r->num_blips++];
  947.           b->x = grid2map(x) + MAP_BOX_SIZE / 4;
  948.           b->y = grid2map(y) + MAP_BOX_SIZE / 4;
  949. diff -c -r ./Src/setup.c ../xtank1.3f-sound/Src/setup.c
  950. *** ./Src/setup.c    Sun Aug 30 14:15:21 1992
  951. --- ../xtank1.3f-sound/Src/setup.c    Fri Nov 13 11:53:54 1992
  952. ***************
  953. *** 65,70 ****
  954. --- 65,73 ----
  955.   #include "globals.h"
  956.   #include "assert.h"
  957.   #include "bullet.h"
  958. + #ifdef SOUND
  959. + #include "sound.h"
  960. + #endif SOUND
  961.   
  962.   extern Map real_map;
  963.   extern Boolean game_paused;
  964. ***************
  965. *** 296,304 ****
  966. --- 299,315 ----
  967.   
  968.       game_running = True;
  969.   
  970. + #ifdef SOUND
  971. +     play_all(START_SOUND);
  972. + #endif SOUND
  973.       do {
  974.           status = animate();
  975.       } while (status == GAME_RUNNING);
  976. + #ifdef SOUND
  977. +     play_all(END_SOUND);
  978. + #endif SOUND
  979.   
  980.       game_running = False;
  981.   
  982. diff -c -r ./Src/Include/settings.h ../xtank1.3f-sound/Src/Include/settings.h
  983. *** ./Src/Include/settings.h    Sun Aug 30 14:15:51 1992
  984. --- ../xtank1.3f-sound/Src/Include/settings.h    Fri Nov 13 11:22:06 1992
  985. ***************
  986. *** 18,23 ****
  987. --- 18,26 ----
  988.       Boolean no_nametags;    /* whether vehicles are anonymous */
  989.       Boolean team_score;        /* whether to use team scoring */
  990.       Boolean no_radar;        /* turns everyone's radar off */
  991. + #ifdef SOUND
  992. +     Boolean no_sound;        /* turns everyone's sound off */
  993. + #endif SOUND
  994.       Boolean player_teleport;    /* whether players can teleport */
  995.       Boolean disc_teleport;    /* whether discs can teleport */
  996.       Boolean teleport_from_team;        /* whether we can teleport from */
  997. diff -c -r ./Src/Include/terminal.h ../xtank1.3f-sound/Src/Include/terminal.h
  998. *** ./Src/Include/terminal.h    Sun Aug 30 14:15:53 1992
  999. --- ../xtank1.3f-sound/Src/Include/terminal.h    Fri Nov 13 11:20:28 1992
  1000. ***************
  1001. *** 57,62 ****
  1002. --- 57,65 ----
  1003.                      vehicle */
  1004.       int mouse_speed;        /* True if this terminal sets vehicle speed */
  1005.                               /* by mouse clicks */
  1006. + #ifdef SOUND
  1007. +     int      rplay_fd;
  1008. + #endif SOUND
  1009.   } Terminal;
  1010.   
  1011.  
  1012.